package hi.doubletracker;

import hi.Connector;
import hi.KeyController;

import java.awt.AWTException;
import java.awt.Rectangle;
import java.io.IOException;

import javax.swing.JFrame;

public class DoubleCursorClient {
	
    public static void main(String[] args) throws IOException, AWTException {
		
	
		KeyController keyController = new KeyController();
		

		//Mouse window
		JFrame frame = new JFrame("HandInterface Java Double Cursor Client");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.addKeyListener(keyController); //listen for keys
		
		int windowWidth = 640;           // Window width in pixels
		int windowHeight = 480;          // Window height in pixels
		int windowX = 50;
		int windowY = 50;
		Rectangle mouseRect = new Rectangle(windowX, windowY, windowWidth, windowHeight);

		frame.setBounds(windowX, windowY,       // Set position
						  windowWidth, windowHeight);  // and size
		
		
		keyController.addVisibilityListener(frame); //use keyboard shortcuts to hide/show mouse range window
		
		
		DoubleTrackerPanel dtPanel = new DoubleTrackerPanel(mouseRect);
		frame.getContentPane().add(dtPanel);
		frame.setVisible(true);        // Display the window
		


		keyController.addMouseActiveListener(dtPanel); //use keyboard shortcuts to enable mouse control
		
		Connector connector = new Connector();
		connector.addFullListener(dtPanel);
		keyController.setConnector(connector);
    }


}